Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WiP] Build on OSX (#3) #25

Merged
merged 4 commits into from
Oct 7, 2018
Merged

[WiP] Build on OSX (#3) #25

merged 4 commits into from
Oct 7, 2018

Conversation

kzantow
Copy link
Collaborator

@kzantow kzantow commented Oct 2, 2018

Well, I got this compiling on OSX (fixing #3) without the need for LLVM (and yes, probably bugs that need fixing in the filesystem stuff).

But then update to master broke it all, again. sigh

This only helps VST2 and it's still not recognized by any hosts...

void create_directories(path p) {
mode_t nMode = 0733; // UNIX style permissions
int nError = 0;
#if defined(_WIN32)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

obviously not necessary...

@@ -293,6 +300,7 @@ plugincommon()
files {
"src/vst2/**.cpp",
"src/vst2/**.h",
"VST_SDK_2.4/public.sdk/source/vst2.x/**.cpp",
"vst3sdk/public.sdk/source/vst2.x/**.cpp",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this does not actually include anything to solve VST 2 compilation, does it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kzantow how does one incorporate vstsdk2.4 and vst3sdk into the mix, they don't seem to be a part of this repo. do they require a secondary install?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git submodule init ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not perfect. unclear licensing etc. it seems that Steinb0rg has completely dropped support for VST 2, which I have no idea how the license plays out in that case. but i found some stuff to make it work, barring being taken down

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I was able to find a VST2.4SDK from somewhere and am linking to it outside the repo, for now, hoping to get a Surge.vst to compile and be able to do a tracktion/pluginval run on it just to find out if it can actually work with macOSX.

@@ -20,7 +20,7 @@ using namespace std;
#if __linux
#include <experimental/filesystem>
#else
#include <filesystem>
#include <filesystem.h>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It tries to include the filesystem from c++17 or 14 right?

@asimilon
Copy link
Contributor

asimilon commented Oct 4, 2018

Maybe something else is broken if it's not recognised by any hosts? The build I did (albeit with LLVM) is working (mostly) without issue in Live 10, Reaper and Cubase 9.5

@kurasu kurasu merged commit cd44922 into surge-synthesizer:master Oct 7, 2018
@esaruoho
Copy link
Collaborator

@asimilon hold on - did you actually get a VST2/VST3/AU out of this PR where you could run it with Live10? If so, how? I'm stuck in AU-town with Xcode and am getting Lexical or Preprocessor issue: plugin.h file not found (referenced from aulayer.h).

@asimilon
Copy link
Contributor

@esaruoho I got a mostly working VST2 to build which works under Cubase 9.5, I would assume it will work with Live 10

@esaruoho
Copy link
Collaborator

@asimilon did you get this mostly working VST2 working on Linux, Windows or macOS? Did the interface pop up?

@kzantow Were you attempting to build a VST2,VST3 or AudioUnit? Have you seen the newest PR #69

@kzantow
Copy link
Collaborator Author

kzantow commented Dec 14, 2018

@esaruoho only building VST2 at the moment

@asimilon
Copy link
Contributor

@esaruoho I got a working VST2 build on macOS. None of the context menus work, and I patched a crash when trying to do anything with presets, otherwise it works in all the hosts I tried.

@kzantow
Copy link
Collaborator Author

kzantow commented Dec 14, 2018

@asimilon @esaruoho I hacked together a filesystem implementation just to get past compilation issues as part of this PR without testing it at all since I couldn't actually get the VST2 to run, it's probably buggy.

@asimilon
Copy link
Contributor

@kzantow I used the homebrew clang to get it to compile and run, more or less as is (no need for the experimental:: namespace with that). It's available in a branch on my fork if you just interested in getting a runnable VST2.

@esaruoho
Copy link
Collaborator

@asimilon did you push a PR with the crash fix? :) since the macOS 64 bit audiounit can work now, i'm attempting to link a VST2.4SDK into this mix and get a VST2 out, hoping Renoise and other apps will load it.
@asimilon regards homebrew clang -- do you have instructions on how to do this? I'd like to follow them, or could you do a PR that updates the macOS VST2 instructions in README.md ? I can help if ya don't have the time for it? :) I'd like to get this running with as many different OS's as possible, so it will eventually progress and some more bugs will get squashed.

@esaruoho
Copy link
Collaborator

@kzantow I used the homebrew clang to get it to compile and run, more or less as is (no need for the experimental:: namespace with that). It's available in a branch on my fork if you just interested in getting a runnable VST2.

one more thing.. I wasn't able to find clang with
brew install clang
or
brew cask install clang

what am i missing? i've bookmarked your branch
https://github.com/asimilon/surge/tree/macOS_VST2_build - but am wondering, how come it never made into a PR? looks like it'd progress macOSVST2 building by quite a bit? :)

@asimilon
Copy link
Contributor

@esaruoho brew install llvm. I used these instructions to set up the XCode project.
I didn't issue a pull request as I haven't found any time or information on how to set up premake5 to make those changes necessary for the XCode project, also I don't see it as ideal that it's necessary to fiddle around with using homebrew to get a build, but at the same time I'm not interested in upgrading my macOS version just yet to be able to use XCode 10 (and by all accounts it's riddled with bugs at the moment for c++ development, and that's my day job, so I'm steering clear until absolutely necessary or I hear it gets fixed!)

@esaruoho
Copy link
Collaborator

@asimilon hi, do you have some sort of a list of which things were necessary in the Xcode Project to get it going? Maybe some of them can be done somehow into premake5.lua :)

I can sympathise with not wanting to update, but would love to see if could use the "the changes necessary in the xcode project" info to modify premake5 and get it going on a newer version of xcode.

I don't mind at all having llvm be required to bake a VST2, that's for sure, as long as it works. I have llvm installed now. I'm just not sure how to compare a vst2.xcodeproj and your vst2.xcodeproj to see the changes/differences, cos i'm not clever like that.

@kzantow
Copy link
Collaborator Author

kzantow commented Dec 14, 2018

@asimilon one thing of note: XCode 10 has removed 32-bit support, so if there's any desire to provide a universal or individually built 32-bit binary, it has to be with XCode 9. I downgraded after I learned this...

@kzantow
Copy link
Collaborator Author

kzantow commented Dec 15, 2018

@asimilon well, I built your branch macOS_VST2_build on a different Mac, even, with XCode 9, but I'm still getting:

2018-12-14 20:20:54.991 BitwigPluginHost[34463:1045984] Error loading /Library/Audio/Plug-Ins/VST/Surge.vst/Contents/MacOS/SURGE:  dlopen(/Library/Audio/Plug-Ins/VST/Surge.vst/Contents/MacOS/SURGE, 265): no suitable image found.  Did find:
	/Library/Audio/Plug-Ins/VST/Surge.vst/Contents/MacOS/SURGE: mach-o, but wrong architecture
	/Library/Audio/Plug-Ins/VST/Surge.vst/Contents/MacOS/Surge: mach-o, but wrong architecture

And, like before it seems to be the right architecture:

$ lipo -info /Library/Audio/Plug-Ins/VST/Surge.vst/Contents/MacOS/Surge 
Non-fat file: /Library/Audio/Plug-Ins/VST/Surge.vst/Contents/MacOS/Surge is architecture: x86_64

@kzantow
Copy link
Collaborator Author

kzantow commented Dec 15, 2018

... and commenting on this PR is really the wrong place for this discussion, but I am also unable to get AU to load in AU Lab... :-/

@esaruoho
Copy link
Collaborator

@kzantow did you attempt to nuke the AU Cache?
( from readme.md)

Then you have successfully built and installed the AU.

To use the AU in Logic, Mainstage, GarageBand, and so on, you need to do one more one-time step which is to invalidate your AU cache so Logic rescans. The easiest way to do this is

mv ~/Library/Caches/AudioUnitCache ~/Desktop
Then restart Logic. If everything works and starts up again you can delete the cache on your desktop. If it doesn't, well, then you have it.

@kzantow
Copy link
Collaborator Author

kzantow commented Dec 15, 2018

I just had a look and I don't have that folder (I don't have/use Logic). Only tried AU Lab, which doesn't show the plugin. I actually just reinstalled OSX fresh on this 2nd Mac and upgraded to Mojave (I also am building on High Sierra with the same issue). I built @asimilon 's branch with llvm from brew as was suggested, but had the same error about wrong architecture. I'm leaning towards the issue possibly being some library reference that resolves as 32-bit only, but I can't figure out which one. I've used otool -L to list them and validated they all say there's an x86_64 architecture present... or maybe this is a red herring and it's just double reporting the error from the 32-bit Bitwig host and there's some other issue going on. I'm going to try to see if I can get anything to debug during the load phase (I really should have tried this before).

@kzantow
Copy link
Collaborator Author

kzantow commented Dec 15, 2018

Hmm, well a different thing when trying to debug this in REAPER:

dlopen(/Users/kzantow/Documents/programming/surge/products/Surge.vst/Contents/MacOS/SURGE, 0x00000115)
dlopen(/Users/kzantow/Documents/programming/surge/products/Surge.vst/Contents/MacOS/SURGE, 0x00000106)
dyld: loaded: /Users/kzantow/Documents/programming/surge/products/Surge.vst/Contents/MacOS/SURGE
dyld_image_path_containing_address(0x11a800000)
dyld_image_path_containing_address(0x11a800000)
_dyld_is_memory_immutable(0x11a800000, 28)
  dlopen(/Users/kzantow/Documents/programming/surge/products/Surge.vst/Contents/MacOS/SURGE) ==> 0x1012263e1
dlsym(0x1012263e1, SWELL_dllMain)
  dlsym(0x1012263e1, SWELL_dllMain) ==> NULL
dlsym(0x1012263e1, VSTPluginMain)
  dlsym(0x1012263e1, VSTPluginMain) ==> NULL
dlsym(0x1012263e1, main_macho)
  dlsym(0x1012263e1, main_macho) ==> NULL
dlclose(0x1012263e1)
dlclose(), found unused image 0x1012263e0 SURGE
dlclose(), running static terminators for 0x1012263e0 SURGE
dlclose(), deleting 0x1012263e0 SURGE
dyld: unloaded: /Users/kzantow/Documents/programming/surge/products/Surge.vst/Contents/MacOS/SURGE

Note dlsym(0x1012263e1, VSTPluginMain) ==> NULL and dlclose(), found unused image 0x1012263e0 SURGE ...

@kzantow
Copy link
Collaborator Author

kzantow commented Dec 15, 2018

... I think the wrong architecture thing was a red herring. grr. I'm such a C++ noob. :)

@kzantow
Copy link
Collaborator Author

kzantow commented Dec 15, 2018

🤦‍♂️

@asimilon
Copy link
Contributor

asimilon commented Dec 15, 2018

@asimilon hi, do you have some sort of a list of which things were necessary in the Xcode Project to get it going? Maybe some of them can be done somehow into premake5.lua :)

Afraid I don't. Off the top of my head it was stuff like setting the CC= flag to use the llvm compiler, there were a bunch of other things that I fixed one by one based on the errors that XCode would throw at me (iirc setting the c++ version, something about not indexing during compilation, sorry it was about 6 weeks ago and my memory is hazy!)

If you know of a decent reference for premake5 and XCode it would be useful, the official documentation is lacking to say the least!

@kzantow
Copy link
Collaborator Author

kzantow commented Dec 15, 2018

Okay, I figured out why Surge doesn't work for me. Finally. It's not exporting the _VSTPluginMain symbol. Does anyone know how to make this happen? It's only exporting a name-munged version of it:

$ nm -gU products/Surge.vst/Contents/MacOS/Surge | grep VSTPluginMain
0000000000079e70 T __Z13VSTPluginMainPFxP7AEffectiixPvfE

Whereas my own plugin has:

$ nm -gU ~/Library/Audio/Plug-Ins/VST/osc.vst/Contents/MacOS/osc |grep VSTPluginMain
00000000000024e0 T _VSTPluginMain

This is what the VSTPluginMain definition looks like after I even coded it up directly (in vst2 sdk / ... / vstplugmain.cpp), but still doesn't work:

#define EXPORT __attribute__((visibility("default")))

EXPORT void* VSTPluginMain(audioMasterCallback audioMaster)
{
   // when debugging, this is never called; library debug reports NULL for VSTPluginMain symbol lookup
}

What am I doing wrong?

Any ideas @asimilon @esaruoho ?

baconpaul added a commit to baconpaul/surge that referenced this pull request Jan 4, 2019
As discussed in surge-synthesizer#25, set up a directory structure for assets which
would allow multiple skins in the future. Pull in the assets that
@kurasu checked in 2 weeks ago in a subdir; and set up the basic
directory for folks to start making the "original" skin.
baconpaul pushed a commit to baconpaul/surge that referenced this pull request Jul 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants